<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function display(){
				var b1 = document.getElementById("button")
				console.log(b1);
				var b2 = document.getElementsByClassName("button")
				console.log(b2[0]);
				var b3 = document.getElementsByName("button")
				console.log(b3[0]);
				var b4 = document.getElementsByTagName("button")
				console.log(b4[3]);
				var b5 = document.querySelector("button[type]") //选中具有type属性的button
				console.log(b5);
				var b6 = document.querySelectorAll("button") //通过标签button选中所有的按钮
				console.log(b6[5]);
			}
		</script>
	</head>
	<body onload="display()">
		<button id="button">按钮1</button>
		<button class="button">按钮2</button>
		<button name="button">按钮3</button>
		<button>按钮4</button>
		<button type="button">按钮5</button>
		<button>按钮6</button>		
	</body>
</html>
